int dat[10][7] = {
  {0, 0, 0, 0, 0, 0, 1}, //0
  {1, 0, 0, 1, 1, 1, 1}, //1
  {0, 0, 1, 0, 0, 1, 0}, //2
  {0, 0, 0, 0, 1, 1, 0}, //3
  {1, 0, 0, 1, 1, 0, 0}, //4
  {0, 1, 0, 0, 1, 0, 0}, //5
  {0, 1, 0, 0, 0, 0, 0}, //6
  {0, 0, 0, 0, 1, 1, 1}, //7
  {0, 0, 0, 0, 0, 0, 0}, //8
  {0, 0, 0, 0, 1, 0, 0} //9
};

// PA0-PA7 --- ABCDEFG DP
void setup() {
  // put your setup code here, to run once:
  for (int i = 0; i <= 7; i++) { //初始化PA0 到 PA7引脚。 // A-G、DP
    pinMode(i, OUTPUT);
    digitalWrite(i, LOW);
  }
  for (int i = 21; i <= 24; i++) { //初始化PB5 到 PB8引脚。 // 位控制 1-4
                                 // 21-24
    pinMode(i, OUTPUT);
    digitalWrite(i, LOW);
  }

}
void loop() {

  // put your main code here, to run repeatedly:
//  for (int j = 21; j <= 24; j++) { //1 到 4位 使能引脚 高电平
//    digitalWrite(j, HIGH);
//  }
//  for (int k = 0; k <= 9; k++) { //0到9数字显示
//    for (int i = 0; i <= 7; i++) {
//      digitalWrite(i, dat[k][i]); //数码段数组对应依次输出。让数字从0 显示到 9.
//    }
//    delay(300);
//  }

  
}
